<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
    <title>ShellCheck: GitLab-CI – </title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
  </head>
  <body style="margin-left: auto; margin-right: auto; max-width: 800px">
    <h1>GitLab-CI – ShellCheck Wiki</h1>
    <a href="https://github.com/koalaman/shellcheck/wiki/GitLab-CI">See this page on GitHub</a>
    <p style="display: none"><a href="index.html">Sitemap</a></p>
    <hr />
    <p>Simple test job for GitLab (analyse <code>testScript.sh</code>):</p>
<div class="sourceCode" id="cb1"><pre
class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb1-1"><a href="GitLab-CI.html#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test</span><span class="kw">:</span></span>
<span id="cb1-2"><a href="GitLab-CI.html#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="at">    </span><span class="fu">image</span><span class="kw">:</span><span class="at"> koalaman/shellcheck-alpine:latest</span></span>
<span id="cb1-3"><a href="GitLab-CI.html#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="at">    </span><span class="fu">stage</span><span class="kw">:</span><span class="at"> test</span></span>
<span id="cb1-4"><a href="GitLab-CI.html#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="at">    </span><span class="fu">script</span><span class="kw">:</span><span class="at"> </span></span>
<span id="cb1-5"><a href="GitLab-CI.html#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="at">    </span><span class="kw">-</span><span class="at"> shellcheck testScript.sh</span></span></code></pre></div>
<p>Here is a CI job that will lint all shell-scripts in a Git
repository:</p>
<div class="sourceCode" id="cb2"><pre
class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb2-1"><a href="GitLab-CI.html#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">test</span><span class="kw">:</span></span>
<span id="cb2-2"><a href="GitLab-CI.html#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="at">    </span><span class="fu">image</span><span class="kw">:</span><span class="at"> koalaman/shellcheck-alpine:latest</span></span>
<span id="cb2-3"><a href="GitLab-CI.html#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="at">    </span><span class="fu">stage</span><span class="kw">:</span><span class="at"> test</span></span>
<span id="cb2-4"><a href="GitLab-CI.html#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="at">    </span><span class="fu">before_script</span><span class="kw">:</span></span>
<span id="cb2-5"><a href="GitLab-CI.html#cb2-5" aria-hidden="true" tabindex="-1"></a><span class="at">    </span><span class="kw">-</span><span class="at"> apk update</span></span>
<span id="cb2-6"><a href="GitLab-CI.html#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="at">    </span><span class="kw">-</span><span class="at"> apk add git</span></span>
<span id="cb2-7"><a href="GitLab-CI.html#cb2-7" aria-hidden="true" tabindex="-1"></a><span class="at">    </span><span class="fu">script</span><span class="kw">:</span></span>
<span id="cb2-8"><a href="GitLab-CI.html#cb2-8" aria-hidden="true" tabindex="-1"></a><span class="at">    </span><span class="kw">-</span><span class="at"> git ls-files --exclude=&#39;*.sh&#39; --ignored -c -z | xargs -0r shellcheck</span></span></code></pre></div>
<p>If you want to create a JUnit XML report to see in the GitLab's UI,
check the instructions <a href="JUnit.html">here</a>, additionally checkstyle
can also be <a href="checkstyle2text.html">transformed</a> back into text
again for logging purposes.</p>
    <hr />
    <p style='font-size: 80%'><a href="../index.html">ShellCheck</a> is a static analysis tool for shell scripts. This page is part of its documentation.</p>
  </body>
</html>


